import axios from 'axios';

class service {
    request(data) {
        return new Promise((resolve, reject) => {
            axios({
                method: data.method || 'get',

                url: data.url || null,

                data: data.data || null,

                params: data.params || null,

                headers: data.headers || { 'X-Requested-With': 'XMLHttpRequest' }
            }).then((res) => {
                resolve(res.data)
            }).catch((error) => {
                reject(error)
            })
        })
    }

}
export default service;